﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Zhongy
{
    public class MsgCenter:MonoBase
    {
        public static MsgCenter Instance = null;

        void Awake()
        {
            Instance = this;

            gameObject.AddComponent<NetSManager>();
            gameObject.AddComponent<GameManager>();
            gameObject.AddComponent<TimerManager>();

            DontDestroyOnLoad(gameObject);
        }

        void Update()
        {

        }

        public void Dispatch(int transCode, int evtCode,params object[] message)
        {

            switch (transCode)
            {
                case TransCode.Net:
                    NetSManager.Instance.Execute(evtCode, message);
                    break;

                case TransCode.Game:
                    GameManager.Instance.Execute(evtCode, message);
                    break;
            }
        }
    }
}
